package com.shop.shoporder.service.impl;

import com.shop.shoporder.entity.AdminLog;
import com.shop.shoporder.mapper.AdminLogMapper;
import com.shop.shoporder.service.AdminLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("AdminLogService")
public class AdminLogServiceImpl implements AdminLogService {

    @Autowired
    AdminLogMapper adminLogMapper;

    @Override
    public int insert(AdminLog record) throws Exception{
        return adminLogMapper.insert(record);
    }

    @Override
    public int insertSelective(AdminLog record) throws Exception {
        return adminLogMapper.insertSelective(record) ;
    }

    @Override
    public AdminLog selectByPrimaryKey(int id) throws Exception{
        return adminLogMapper.selectByPrimaryKey(id);
    }

    @Override
    public AdminLog AddAdmin(int objType,int objId,String remark,int AID) throws Exception{

        AdminLog adminLog = new AdminLog();
        adminLog.setObjType(objType);
        adminLog.setObjId(objId);
        adminLog.setRemark(remark);
        adminLog.setAid(AID);
        int row = adminLogMapper.insertSelective(adminLog);
        if(row>0)
        {
            return adminLog;
        }
        else
        {
            return null;
        }
    }



}
